<!DOCTYPE html>
<html class="ui-page-login">

<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title></title>
    <!--标准mui.css-->
    <link rel="stylesheet" th:href="@{/css/mui.min.css}">
    <!--App自定义的css-->
    <link rel="stylesheet" th:href="@{/css/app.css}"/>
    <style>

    </style>
    <style>
        .area {
            margin: 20px auto 0px auto;
        }

        .mui-input-group:first-child {
            margin-top: 20px;
        }

        .mui-input-group label {
            width: 22%;
        }

        .mui-input-row label ~ input,
        .mui-input-row label ~ select,
        .mui-input-row label ~ textarea {
            width: 88%;
        }

        .mui-checkbox input[type=checkbox],
        .mui-radio input[type=radio] {
            top: 6px;
        }

        .mui-content-padded {
            margin-top: 25px;
        }

        .mui-btn {
            padding: 10px;
        }

        label {
            display: none;
        }

        input {
            padding-left: 45px !important;
            width: 100% !important;
        }
    </style>
</head>

<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">注册</h1>
</header>
<div class="mui-content">
    <form class="mui-input-group">
        <div class="mui-input-row">
            <label>*</label>
            <input id='name' value="heenlin" type="text" class="mui-input-clear mui-input" placeholder="请输入昵称（必填）">
        </div>
        <div class="mui-input-row">
            <label>*</label>
            <input id='phone' value="18312345671" type="text" class="mui-input-clear mui-input"
                   placeholder="请输入手机号（必填）">
        </div>
        <div class="mui-input-row">
            <label>*</label>
            <input id='password' value="123456" type="password" class="mui-input-clear mui-input"
                   placeholder="请输入密码（必填）">
        </div>
        <div class="mui-input-row">
            <label>*</label>
            <input id='password_confirm' value="123456" type="password" class="mui-input-clear mui-input"
                   placeholder="请确认密码（必填）">
        </div>
        <div class="mui-input-row">
            <label>*</label>
            <input id='stuNo' value="202008" type="email" class="mui-input-clear mui-input" placeholder="请输入学号（必填）">
        </div>
        <div class="mui-input-row mui-select">
            <label>*</label>
            <select id="zYe">
                <option value="计算机" selected="selected">计算机</option>
                <option value="英语">英语</option>
                <option value="英语">数学</option>
            </select>
        </div>
    </form>
    <div class="mui-content-padded">
        <button id='reg' class="mui-btn mui-btn-block mui-btn-primary" onclick="reg()">注册</button>
    </div>
</div>
<script th:src="@{/js/mui.min.js}"></script>
<script th:src="@{/js/jquery-1.8.3.min.js}"></script>
<script th:src="@{/js/app.js}"></script>
<script>

    function reg() {
        var name = $("#name").val();
        if (isEmpty(name)) {
            mui.toast("请输入昵称");
            return;
        }
        var phone = $("#phone").val();
        if (isEmpty(phone)) {
            mui.toast("请输入手机号");
            return;
        }
        var password = $("#password").val();
        if (isEmpty(password)) {
            mui.toast("请输入密码");
            return;
        }
        var stuNo = $("#stuNo").val();
        if (isEmpty(stuNo)) {
            mui.toast("请输入学号");
            return;
        }
        var zYe = $("#zYe").val();


        var remark = {
            "stuNo": stuNo,
            "zYe": zYe,
        };
        var url = "/app/register";
        var data = {
            "userName": name,
            "phonenumber": phone,
            "loginName": phone,
            "password":password,
            "sex": 1,
            "roleIds": '2',
            "postIds": '2',
            "deptId": '105',
            "email": phone + "@123.com",
            "remark": JSON.stringify(remark),
        };
        post(url, data, function (result) {
            if (result.code == 0) {
                window.location.href = "/app/appLogin";
            }
        })

    }


</script>
</body>

</html>